package nc.ui.uif2.actions;

import java.awt.event.ActionEvent;
import nc.ui.uif2.NCAction;
import nc.ui.uif2.UIState;
import nc.ui.uif2.model.BillManageModel;

public class LastLineAction extends NCAction
{
  private static final long serialVersionUID = -6802520877691899452L;
  private BillManageModel model = null;

  public LastLineAction()
  {
    ActionInitializer.initializeAction(this, 24);
  }

  public void doAction(ActionEvent e) throws Exception
  {
    this.model.lastRow();
  }

  protected boolean isActionEnable()
  {
    return (this.model.getUiState() == UIState.NOT_EDIT) && (this.model.getSelectedRow() >= 0) && (!this.model.isLastRow());
  }

  public BillManageModel getModel()
  {
    return this.model;
  }

  public void setModel(BillManageModel model) {
    this.model = model;
    model.addAppEventListener(this);
  }
}